;Text_Buffer is the 25 character buffer used to hold the line of text
;to display on a particular row.

;Start_Of_Word is the 2-byte location in the beginning of a word.
;Start_Of_Word does not have its value changed until a new word is reached.

;String_Location is the character currently being read.  2-Bytes.

;Length_Of_String is one byte, and is used to see if a particular line of text
;will exceed 96 pixels.

;Text_Buffer_Pointer is one byte.

;Text_Y_Coordinate is one byte.

;Previous_Line and Next_Line are each two bytes, pointing to the
;string location to go to when scrolling up or down
;Previous_Line_Temp is used for Previous_Line

;Start-up Code for reading text to display on the mission-briefing screen.

Cant_Move_Down .equ appbackupscreen + 72
Cant_Move_Up .equ appbackupscreen + 74

Sprite_Width .equ appbackupscreen + 100
Text_Buffer .equ appbackupscreen
Start_Of_Word .equ appbackupscreen + 50
String_Location .equ appbackupscreen + 52
Length_Of_String .equ appbackupscreen + 54

Text_Buffer_Pointer .equ appbackupscreen + 56
Text_Y_Coordinate .equ appbackupscreen + 58

Previous_Line .equ appbackupscreen + 60
Previous_Line_Temp .equ appbackupscreen + 62
Next_Line .equ appbackupscreen + 64

Start_Of_Line .equ appbackupscreen + 66

Stack_Pointer .equ appbackupscreen + 68
Stack_Pointer_2 .equ appbackupscreen + 70
Stack_For_Previous_Text .equ appbackupscreen + 700


Mission_Briefing_X_Position

Start:


	;Search through the line for instructions

	ld hl, Test_Data - 1

Repeat_Search:

	inc hl
	ld a, (hl)

	cp 1
	jr nz, _

	call Display_Big_Text
	jr Repeat_Search

_

	cp 7
	jr nz, _

	call Display_Cutscene
	jr Repeat_Search

_
	cp 255
	jr nz, _
	bjump(_jforcecmdnochar)
_

	cp 5
	jr nz, Repeat_Search
	call Display_Mission_Briefing
	jr Repeat_Search






Display_Mission_Briefing:

	inc hl
	push hl
	ld hl, Mission_Briefing_Box  ;We place the box for 				;holding the
				;3 portraits on the screen

	ld de, plotsscreen
	ld bc, 26 * 12

	ldir

	pop hl			;The sprite to display in the box
	

	ld a, 2	;X position for a portrait image

Display_3_Portraits:


	push af

	;Get the sprite data we need for a portrait.

	ld a, (hl)
	inc hl			
	push hl			

	;A sprite location takes two bytes.

	add a, a		

	ld hl, Sprite_Table

	ld d, 0
	ld e, a
	add hl, de

	ld e, (hl)
	inc hl
	ld d, (hl)

	ex de, hl

;HL now points to the sprite.

	push hl
	pop ix	;IX contains the character portrait.

	ld a, 3
	ld (Sprite_Width), a

	ld b, 24
	ld l, 2	
	pop af
	push af

	call Put_Sprite_Overwrite















Display_Big_Text:


	SET textWrite, (IY + sGrFlags)
	SET fracDrawLFont, (IY + fontFlags)


	inc hl		;HL Points to X and Y
			;positions of big text
			;to display

_
	ld a, (hl)
	cp 251	;251 means the text is over and we
		;can pause.

	jr z, Big_Text_Get_Key



	inc hl
	ld e, (hl)
	inc hl		;HL points to the text to display.
	ld d, (hl)

	ld (penCol), de

	call VPutSS
	jr -_

Big_Text_Get_Key:

	call safecopy
	B_CALL _getKey

	RES textWrite, (IY + sGrFlags)
	RES fracDrawLFont, (IY + fontFlags)

	B_CALL _GrBufClr

	ret


VPutSS:
	PUSH AF
	PUSH DE
	PUSH IX
VPutS10:
	LD A,(HL) ; get a character of string name
	INC HL
	OR A ; end of string?
	JR Z, VputS20 ; yes --->
	B_CALL VPutMap ; display one character of string
	JR NC, VPutS10 ; display rest of string IF FITS
VputS20:
	POP IX
	POP DE
	POP AF
	RET


	



Display_Cutscene:

;Search through the cutscene data for cutscene instructions.
;0 = Display Text with Character Portrait
;1 = Display Image as Overwrite.
;2 = Pause


Search_For_Cutscene_Instructions:

	ld a, (hl)

	cp 1
	jr nz, _

	call Cutscene_Display_Image
	jp Move_To_Next_Cutscene_Byte

_

	or a
	jp nz, aa

	

;Get ready to call the routine for displaying
	;scrolling text

	
	
	inc hl
	push hl		;Saves the location, which
			;points to the sprite the portait is located at


	;Save the background

	ld hl, plotsscreen
	ld de, savesscreen
	ld bc, 768
	ldir


	ld ix, Portrait_Box	;We place the box for holding the
				;portrait on the screen

	ld a, 4
	ld (Sprite_Width), a

	ld b, 26
	ld l, 0
	xor a

	call Put_Sprite_Overwrite

	pop hl			;The sprite to display in the box
	


	;Get the sprite data we need for a portrait.

	ld a, (hl)
	inc hl			;HL points to the text to display
	push hl			;Save this position

	;A sprite location takes two bytes.

	add a, a		

	ld hl, Sprite_Table

	ld d, 0
	ld e, a
	add hl, de

	ld e, (hl)
	inc hl
	ld d, (hl)

	ex de, hl

;HL now points to the sprite.

	push hl
	pop ix	;IX contains the character portrait.

	ld a, 3
	ld (Sprite_Width), a

	ld b, 24
	ld l, 2
	ld a, 2

	call Put_Sprite_Overwrite

	ld hl, Text_Box
	ld de, plotsscreen + (25 * 12)
	ld bc, (64 - 25) * 12
	ldir

	pop hl	;Location of Text
	

	call Display_Scrolling_Text


	push hl
	ld hl, savesscreen
	ld de, plotsscreen
	ld bc, 768
	ldir
	pop hl


	jp Move_To_Next_Cutscene_Byte
aa:


cp 2

	jr nz, _
	

	push hl
	ld hl, plotsscreen
	call safecopy
	
	pop hl

	inc hl
	ld c, (hl)	;BC is the number of
			;120ths of a second to pause
	inc hl
	ld b, (hl)
	inc b

	;We will always pause after displaying
	;sprites so the user has a chance to see
	;what is going on.

Repeat_Pause_Timer:


	halt

	ld	a,%00001000
	out	(3),a
	ld	a,%00001010
	out	(3),a

	dec c

	jr nz, Repeat_Pause_Timer
	djnz Repeat_Pause_Timer
	
	jr Move_To_Next_Cutscene_Byte


_









	cp 252
	jr nz, Move_To_Next_Cutscene_Byte

	ret










Move_To_Next_Cutscene_Byte:

	inc hl
	jp Search_For_Cutscene_Instructions




	









	

Cutscene_Display_Image:




	inc hl	;The next four bytes are the following:
		;Width (In bytes), Height, X Position,
		;Y Position

	ld a, (hl)

	ld (Sprite_Width), a

	inc hl
	ld b, (hl)

	inc hl
	ld a, (hl)

	inc hl
	ld c, (hl)

	inc hl	
	push hl	;Saves the position in our campaign data
	ld l, c

	pop ix

	call Put_Sprite_Overwrite

	push ix
	pop hl
	dec hl

	ret














Display_Scrolling_Text:

	ld (Stack_Pointer_2), sp

	ld de, Stack_For_Previous_Text
	ld (Stack_Pointer), de

	ld sp, (Stack_Pointer)

	ld d, h
	ld e, l

	push de
	ld (Stack_Pointer), sp
	ld sp, (Stack_Pointer_2)





	ld a, 1
	ld (Cant_Move_Up), a


	ld (Start_Of_Word), hl	;Start with the first word.
	ld (String_Location), hl
	ld (Start_Of_Line), hl

	xor a
	ld (Text_Buffer_Pointer), a ;Start the line of text at the beginning of the buffer

	ld (Length_Of_String), a	;We don't know how big a line of text is

	ld a, 27
	ld (Text_Y_Coordinate), a

	ld hl, Clear_Text_Buffer
	ld de, Text_Buffer
	ld bc, 25
	ldir

Read_Character_Of_Text:

	;Read a character.  We first check to see if the character will
	;cause the string to flow off of the edge of the screen.

	ld hl, (String_Location)

	;A is the character.

	ld a, (hl)

	cp 250	;End of string? 250 means the end of the text
		;to display

	;If the end of the string has be reached, we have no
	;need to try to display anything else.

	jp nz, ++_


;Fixes a bug
	ld a, (Text_Y_Coordinate)
	cp 57
	jr z, _
;End bug fix


	ld a, 1
	ld (Cant_Move_Down), a


_
	jp Get_Key

_


	;Find the number of pixels a character requires so that
	;we can see if the line of text is going to be too
	;big to fit on the screen

	call Add_To_Length_Of_String

	ld a, (Length_Of_String)

	cp 92	;Is our string too big for the screen?

	;If so, we shorten the screen so that we can safely display
	;one line of text

	jp nc, Cut_String_To_Fit_On_Screen


	;Check to see if the character is a space, meaning that
	;one word has ended

	ld hl, (String_Location)
	ld a, (hl)

	cp $2F	;End of Word

	jr nz, Add_Character_To_String_And_Move_To_Next_Character_To_Check

	;If the character is a space, we tell the calculator
	;that one word has ended and we need to start a new word

	ld c, a	;Save the fact that the character is a space

	ld hl, (String_Location)
	inc hl

	ld (Start_Of_Word), hl		;New word
	ld (String_Location), hl

	ld a, (Text_Buffer_Pointer)

	ld hl, Text_Buffer

	call Add_A_To_HL

	ld (hl), c

	ld hl, Text_Buffer_Pointer
	inc (hl)


	jr Read_Character_Of_Text	

Add_Character_To_String_And_Move_To_Next_Character_To_Check:

	ld a, (Text_Buffer_Pointer)

	ld hl, Text_Buffer

	call Add_A_To_HL

	;Now we place the character in the line of text to display.

	
	ex de, hl

	ld hl, (String_Location)
	ld a, (hl)
	ld (de), a

	
	inc hl	;Goes to the next character of the string
	ld (String_Location), hl

	ld hl, Text_Buffer_Pointer
	inc (hl)

	jp Read_Character_Of_Text

	
Cut_String_To_Fit_On_Screen:

	;We display the text that will fit on the screen,
	;and then move onto a new line of text.

	
	call Put_Line_Of_Text



	ld a, (Text_Y_Coordinate)

	cp 27

	call z, Create_Previous_Line

	ld hl, (Start_Of_Word)
	ld (String_Location), hl
	ld (Start_Of_Line), hl


	add a, 6

	cp 59

	jp nc, Get_Key	;Out of screen space, so can't
			;place more text

	;We can safely move to the next line of the screen.

	cp 33

	call z, Create_Next_Line


	ld a, (Text_Y_Coordinate)
	add a, 6

	ld (Text_Y_Coordinate), a

	


	jp Read_Character_Of_Text


Get_Key:

	ld a, (Text_Y_Coordinate)

	cp 27

	call z, Create_Previous_Line

	ld hl, (String_Location)
	ld (Start_Of_Word), hl

	call Put_Line_Of_Text


	ld hl, plotsscreen
	call safecopy
	ld a, 27
	ld (Text_Y_Coordinate), a
_

	push hl
	ld hl, Text_Box
	ld de, plotsscreen + (25 * 12)
	ld bc, (64 - 25) * 12
	ldir
	

	B_CALL _getKey
	pop hl

	cp kUp

	jr z, Key_Up

	cp kDown

	jr z, Key_Down

	cp kEnter

	jr z, Key_Enter

	jr -_


Key_Up:


	ld (Stack_Pointer_2), sp


	ld sp, (Stack_Pointer)

	pop de
	pop hl
	




	or a
	sbc hl, de
	add hl, de
	jr nz, _

	push hl
	push de

	ld (Stack_Pointer), sp	

	ld sp, (Stack_Pointer_2)

	jr -_

_

	ld (Stack_Pointer), sp	

	ld sp, (Stack_Pointer_2)

	xor a
	ld (Cant_Move_Down), a

	ld (Start_Of_Line), hl

	ld (String_Location), hl
	ld (Start_Of_Word), hl
_
	jp Read_Character_Of_Text

Key_Down:

	ld a, (Cant_Move_Down)
	or a
	jr nz, ---_


	xor a
	ld (Cant_Move_Up), a

	ld hl, (Next_Line)
	ld (String_Location), hl
	ld (Start_Of_Word), hl
	ld (Start_Of_Line), hl

	jp Read_Character_Of_Text

Key_Enter:

	;Scan for either a new paragraph, or the end of the text

	ld hl, (String_Location)
	xor a
	ld (Cant_Move_Down), a

Scan_Text:

	ld a, (hl)

	cp 250
	jr z, _

	inc hl
	jr Scan_Text

_


	inc hl

	ld a, (hl)
	cp 251
	ret z
	ld (String_Location), hl
	ld (Start_Of_Word), hl
	ld (Start_Of_Line), hl

	ld de, Stack_For_Previous_Text
	ld (Stack_Pointer), de

	ld sp, (Stack_Pointer)

	push hl

	ld (Stack_Pointer), sp
	ld sp, (Stack_Pointer_2)

	ld a, 27
	ld (Text_Y_Coordinate), a
	xor a
	ld (Text_Buffer_Pointer), a
	ld (Cant_Move_Down), a

	jp Read_Character_Of_Text




Create_Next_Line:

	

	ld hl, (Start_Of_Line)

	ld (Next_Line), hl
	
	ret

Create_Previous_Line:

	ld (Stack_Pointer_2), sp



	ld sp, (Stack_Pointer)

	ld hl, (Start_Of_Line)
	
	push hl

	ld (Stack_Pointer), sp
	
	ld sp, (Stack_Pointer_2)

	ret



Clear_Text_Buffer:

 .db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0





















Text:

.db "TRANSMITTING:::",250 

.db "GREETINGS./CORSON://I/AM/P","RESIDENT/SOLOMONE/ERRAN/OF/THE
ESEO://I/AM/INFORMNG/YOU","/OF/OUR/DECISION/CONCERNING/THE/NON>AGGRESSION/AND/NON>INTERFERENCE/PACT/YOU/O","FFERED/US/DURING/OUR/LAST/COMMUNICATION:",250

.db "LET/ME/BEGIN/BY/INFORMING/YOU/THAT/WE/HAVE/BEEN/WRONGLY/ACCUSED/BY/THE/TOSONIAN/RACE://DESPITE/WHAT/YOU/AN","D/YOUR/PEOPLE/BELIEVE./CORSON./WE/ARE/IN/NO/WAY/JOYFUL/OVER/THE/ASSISS","INATION/OF/JASILIN://ON/THE/CONTRARY./WE/ARE/VERY/GRIEVED./AND/EVEN/ON/A/PLANET/AS/DISTANT/AS/EARTH./MANKIND/IS/MOURNING/OVER/SUCH/A/HEAVY/LOSS:/BECAUSE/E","VEN/THOUGH/TOSONIANS/AS/A/WHOLE/HAVE/HELD/PREJUDICE/AGAINST/US./JASILI","N/WAS/AS/MUCH/OF/A/COMPANION./A/GUIDE./A/HERO/AND/A/BENEFIT/TO/EARTH/A","S/ZHAS/CURRENTLY/IS://WE/DO/NOT/UNDERSTAND/WHAT/SHE/SAW/IN/US./NOR/DO/WE/FEEL/WE/DESERVED/SUCH/KINDNESS/AND/ATTENTION://YET/THE/FACT/REMAINS/THAT/WE/HAVE/LOST/A/DEAR","/FRIEND./AND/WE/STILL/HAVE/NOT/MOVED/ON/FROM/THE/PAIN/WE/ARE/FEELING/AS/A/RESULT/OF/HER/DEATH:",250

.db "HOWEVER./WE/HAVE/NOT/LET/","OUR/PERSONAL/FEELINGS/COULD/OUR/JUDGEMENT./AND/I/WILL/SAY/WITHOUT/HESITATION/","THAT/WE/HAVE/NO/REASON/TO/BELIEVE/THAT/OUR/BROTHERS./THE/PTALOIDS./ARE/RESPONSIBLE/FOR/SUCH/A/HORRIBLE/CRIME://I/HAVE/HEARD/THAT/THE/TOSONIAN/RACE/PLANS/TO/INVEST","AGATE/THE/MATTER./AND/WE/HUMANS/HAVE/NO/OBJECTION://BUT/I/AND/TH","E/REST/OF/MANKIND/WILL/NEVER/ALLOW/THE/TOSONIANS/TO/TURN/SUCH/AN/INVESTIGATION/INTO/A/HARMFUL/AND/TORTUROUS/INTERREGATION:",250

.db "AND/BECAUSE/WE/WISH/TO/PROTECT","/OUR/ALLIES/FROM/SUCH/AN/ACT/SHOULD/IT/OCCUR./IT/IS/MY/DUTY/TO/INFORM/Y","OU/THAT/WE/CANNOT/SIGN/YOUR/PACT./NOR/CAN/WE/AGREE/TO/STAND/BY/AND/DO/NOTHI","NG/JUST/TO/KEEP/OURSELVES/OUT/OF/HARM=S/WAY://WE/ARE/READY/TO/BACK/THE/PTALOID","S/AND/TO/PROTECT/THEM/IF/THEY/ARE/FACED/WITH/ANY/THREAT:",250

.db "I/DO/NOT/DOUBT/THAT/THIS/WIL","L/CAUSE/YOUR/FEELINGS/TOWARD/US/TO/WORSEN./BUT/I/WOULD/ADVISE/YOU/TO/CONSI","DER/WHAT/IS/BEST/FOR/YOU/AND/ALL/THE/TOSONIAN/PEOPLE/BEFORE/YOU/TAKE/ANY/FORM/OF/RASH/ACTION://THIS/IS/PRESIDENT/ERRAN./OVER/AND/OUT:",250,251




Portrait_Box:

	.db %11111111,%11111111,%11111111,%11110000
	.db %11111111,%11111111,%11111111,%11110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11000000,%00000000,%00000000,%00110000
	.db %11111111,%11111111,%11111111,%11110000





Sprite_Table:

 .dw Corson
 .dw Zalron
 .dw President


Corson:
	.db %00000000,%00000000,%00000000
	.db %00000001,%11111111,%00000000
	.db %00000011,%00000001,%10000000
	.db %00000110,%00000000,%11000000
	.db %00000100,%00000000,%01100000
	.db %00001101,%11000111,%01100000
	.db %00001000,%00101000,%00100000
	.db %00011000,%10000010,%00110000
	.db %00010000,%10000010,%00010000
	.db %00010000,%00000000,%00010000
	.db %00010000,%00000000,%00010000
	.db %00001000,%00000000,%00100000
	.db %00000100,%00000000,%01000000
	.db %00000010,%00000000,%10000000
	.db %00000001,%10000011,%00000000
	.db %00000011,%11111111,%10000000
	.db %00000111,%11111111,%11000000
	.db %00001111,%11101010,%11100000
	.db %00011111,%11101010,%11110000
	.db %00011111,%11111111,%11110000
	.db %00111111,%11101000,%10111000
	.db %00111111,%11101111,%11111000
	.db %01111011,%11111111,%10111100
	.db %01110111,%11111111,%11011100


Zalron:


	.db %00000000,%00000000,%00000000
	.db %00000000,%11111110,%00000000
	.db %00000011,%11111111,%10000000
	.db %00000110,%11111110,%11000000
	.db %00000101,%10000011,%01100000
	.db %00001010,%00000000,%10100000
	.db %00001100,%00000000,%01100000
	.db %00010001,%11000111,%00010000
	.db %00010010,%10101010,%10010000
	.db %00010000,%10000010,%00010000
	.db %00010000,%00000000,%00010000
	.db %00001000,%00000000,%00100000
	.db %00000100,%11111110,%01000000
	.db %00000010,%00000000,%10000000
	.db %00000001,%00000001,%00000000
	.db %00000011,%11111111,%10000000
	.db %00000111,%11111111,%11000000
	.db %00001111,%11101011,%11100000
	.db %00011111,%11101011,%11110000
	.db %00011111,%11111111,%11110000
	.db %00111111,%11101000,%10111000
	.db %00111111,%11101111,%11111000
	.db %01111011,%11111111,%10111100
	.db %01110111,%11111111,%11011100



President:

 	.db %00000000,%00000000,%00000000
	.db %00000000,%11111100,%00000000
	.db %00000011,%11111111,%10000000
	.db %00000111,%10000011,%11000000
	.db %00000110,%00000000,%11100000
	.db %00001100,%11101110,%01100000
	.db %00001001,%00010001,%00100000
	.db %00011000,%01000100,%00110000
	.db %00010000,%01000100,%00010000
	.db %00010000,%00000000,%00010000
	.db %00010000,%00000000,%00010000
	.db %00001000,%00000000,%00100000
	.db %00000100,%01111100,%01000000
	.db %00000011,%00000000,%10000000
	.db %00000001,%10000011,%00000000
	.db %00000011,%11111111,%10000000
	.db %00000111,%10101011,%11000000
	.db %00001111,%00111001,%11100000
	.db %00011111,%00101001,%11110000
	.db %00011111,%00111001,%11110000
	.db %00111111,%00010001,%11111000
	.db %00111011,%00000001,%10111000
	.db %01110111,%10000011,%11011100
	.db %01110111,%11111111,%11011100


















Add_A_To_HL:

	add a,l
 	ld l,a
 	adc a,h    ;^ these two lines
	sub l      ;v increase h if there is carry
 	ld h,a
 
  	ret

;Routines for the custom S.A.D. font. These routines are used so the interrupt
;routine can run









Add_Character_Normal_Length:

	ld a, (Length_Of_String)
	add a, 4
	ld (Length_Of_String), a

	ld a, 1
	ret



Add_Character_Two_Length:

	ld a, (Length_Of_String)
	add a, 2
	ld (Length_Of_String), a

	ld a, 1
	ret

Add_Character_Six_Length:

	ld a, (Length_Of_String)
	add a, 6
	ld (Length_Of_String), a

	ld a, 1
	ret

Add_Character_Eight_Length:

	ld a, (Length_Of_String)
	add a, 8
	ld (Length_Of_String), a

	ld a, 1
	ret

Add_To_Length_Of_String:

	cp $3A
	call c, Add_Character_Normal_Length



	cp $4D
	call z, Add_Character_Six_Length

	cp $57
	call z, Add_Character_Six_Length

	cp 91
	call nc, Add_Character_Eight_Length
	
	cp $3E
	call nc, Add_Character_Normal_Length

	cp $3A
	call nc, Add_Character_Two_Length

	ret


Multiply_DE_By_A

	
	ld hl, 0		;hl will store the product
	ld b, 8			;check 8 bits
	
_

	rrca			;check bit 0 of register A
	jr nc, _

	add hl, de

_

	sla e
	rl d

	djnz --_
	ret

Put_Line_Of_Text:

	xor a
	ld (Text_Buffer_Pointer), a
	ld (Length_Of_String), a

	;Get to the correct location in Text_Buffer, and clear
	;the text afterwards so we don't have bad text at the
	;end of the line

	ld hl, (Start_Of_Word)
	ld de, (Start_Of_Line)

	or a
	sbc hl, de

	ld a, l


	
	ld hl, Text_Buffer
	call Add_A_To_HL


	ld de, Clear_Text_Buffer
	ex de, hl

	ld bc, 25

	ldir

	ld l, 0
	ld a, (Text_Y_Coordinate)
	ld h, a
	ld (penCol), hl

	ld hl, Text_Buffer

	call Put_Text_Zero_End

	ret

Text_Box:

	.db %11111111,%11111111,%11111111,%11111111,%11111111,%11111111,%11111111,%11111111,%11111111,%11111111,%11111111,%11111111
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
	.db %00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000


